package middleware

import (
	"gitee.com/chejiangyi/bsfgo/core/base2"
	"gitee.com/chejiangyi/bsfgo/core/utils"
	"github.com/gin-contrib/requestid"
	"github.com/gin-gonic/gin"
)

type RequestIdMiddleware struct{}

func (*RequestIdMiddleware) GetOrder() float64 {
	return -97
}
func (m *RequestIdMiddleware) Enabled() bool {
	return base2.BsfConfigInstance.GetRequestIdEnabled()
}
func (*RequestIdMiddleware) Middleware(r *gin.Engine) {
	r.Use(requestid.New())
	utils.LogUtil.Info("RequestIdMiddleware已开启,支持http X-Request-ID Header")
}
